package com.soecode.wxtools.bean;

import com.alibaba.fastjson.JSONObject;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

@Data
public class WxUserList {
    private List<WxUser> user_info_list = new ArrayList<>();

    public static WxUserList fromJson(String json) {
        return JSONObject.parseObject(json, WxUserList.class);
    }

    @Data
    public static class WxUser {
        private int subscribe;
        private String openid;
        private String nickname;
        private int sex;
        private String language;
        private String city;
        private String province;
        private String country;
        private String headimgurl;
        private String subscribe_time;
        private String unionid;
        private String remark;
        private int groupid;
        private String[] tagid_list;
        private String[] privilege;
        private String subscribe_scene;
        private int qr_scene;
        private String qr_scene_str;


        public String toJson() {
            return JSONObject.toJSONString(this);
        }

        public static WxUser fromJson(String json) {
            return JSONObject.parseObject(json, WxUser.class);
        }

        @Data
        @NoArgsConstructor
        @AllArgsConstructor
        public static class WxUserGet {
            private String openid;
            private String lang;

            public String toJson() {
                return JSONObject.toJSONString(this);
            }
        }
    }
}

